package com.ruoyi.system.service.impl;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TmcPartyBuildingMapper;
import com.ruoyi.system.domain.TmcPartyBuilding;
import com.ruoyi.system.service.ITmcPartyBuildingService;

/**
 * 社区党建Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-03-31
 */
@Service
public class TmcPartyBuildingServiceImpl implements ITmcPartyBuildingService 
{
    @Autowired
    private TmcPartyBuildingMapper tmcPartyBuildingMapper;

    /**
     * 查询社区党建
     * 
     * @param id 社区党建ID
     * @return 社区党建
     */
    @Override
    public TmcPartyBuilding selectTmcPartyBuildingById(Long id)
    {
        return tmcPartyBuildingMapper.selectTmcPartyBuildingById(id);
    }

    /**
     * 查询社区党建列表
     * 
     * @param tmcPartyBuilding 社区党建
     * @return 社区党建
     */
    @Override
    public List<TmcPartyBuilding> selectTmcPartyBuildingList(TmcPartyBuilding tmcPartyBuilding)
    {
        return tmcPartyBuildingMapper.selectTmcPartyBuildingList(tmcPartyBuilding);
    }

    /**
     * 新增社区党建
     * 
     * @param tmcPartyBuilding 社区党建
     * @return 结果
     */
    @Override
    public int insertTmcPartyBuilding(TmcPartyBuilding tmcPartyBuilding)
    {
        //获取当前时间
        Calendar calendar = Calendar.getInstance();
        tmcPartyBuilding.setCreatetime(calendar.getTime());
        return tmcPartyBuildingMapper.insertTmcPartyBuilding(tmcPartyBuilding);
    }

    /**
     * 修改社区党建
     * 
     * @param tmcPartyBuilding 社区党建
     * @return 结果
     */
    @Override
    public int updateTmcPartyBuilding(TmcPartyBuilding tmcPartyBuilding)
    {
        return tmcPartyBuildingMapper.updateTmcPartyBuilding(tmcPartyBuilding);
    }

    /**
     * 批量删除社区党建
     * 
     * @param ids 需要删除的社区党建ID
     * @return 结果
     */
    @Override
    public int deleteTmcPartyBuildingByIds(Long[] ids)
    {
        return tmcPartyBuildingMapper.deleteTmcPartyBuildingByIds(ids);
    }

    /**
     * 删除社区党建信息
     * 
     * @param id 社区党建ID
     * @return 结果
     */
    @Override
    public int deleteTmcPartyBuildingById(Long id)
    {
        return tmcPartyBuildingMapper.deleteTmcPartyBuildingById(id);
    }

    @Override
    public List<TmcPartyBuilding> queryPartyBuilding() {
        return tmcPartyBuildingMapper.queryPartyBuilding();
    }
}
